<template>
	<view class="content">
		<view class="item" v-for="(item,index) in list" :key="index" @click="openPopup(item)">
			<view class="left">
				<image :src="item.logo.image" mode="aspectFill"></image>
			</view>
			<view class="right">
				<view class="name flex_r_between">
					<text class="hidden">{{item.store_name}}</text>
					<view>运营中</view>
				</view>
				<view class="info">
					<text>技师团队：<i>{{item.technician_num}}人</i></text>
				</view>
				<!-- <view class="info" @click="preview(item.yyzz.image)">
					<text>营业资质：<i style="color: #2E7EFA;">已上传</i></text>
					<uni-icons type="forward" :size="16" color="#333333"></uni-icons>
				</view> -->
				<view class="info" @click.stop="toService(item.id)">
					<text>服务项目：<i>{{item.service_num}}种</i></text>
					<uni-icons type="forward" :size="16" color="#333333"></uni-icons>
				</view>
				<view class="rate flex_r_between">
					<view class="info">
						<text>综合评价：</text>
						<uni-rate allow-half :value="item.high_opinion/item.opinion*5 || 5" disabledColor="#EF5233" disabled :size="18" />
					</view>
					<view class="btn" @click.stop="onJoin(item)">入驻</view>
				</view>
			</view>
		</view>
	
		<store ref="popup"></store>
	</view>
</template>

<script>
	import store from '@/components/store/store.vue'
	export default {
		data() {
			return {
				list:[],
			}
		},
		components:{
			store
		},
		methods: {
			getList(){
				this.request.httpTokenRequest({
					url: "/store.store/getStoreList",
					method: "get"
				}, {}).then(res => {
					if (res.code == 0) {
						res.data.list.forEach(item=>{
							this.list.push(item)
						})
					} else {
						this.$util.msg(res.msg)
						return
					}
				}, error => {})
			},
			
			toService(e){
				this.$util.toUrl(`/technician/business/service?id=${e}`)
			},
			
			onJoin(e){
				this.request.httpTokenRequest({
					url: "/store.store/signUp",
					method: "post"
				}, {
					store_id:e.id
				}).then(res => {
					this.$util.msg(res.msg)
					if (res.code == 0) {
						uni.navigateBack()
					} else {
						return
					}
				}, error => {})
			},
			
			preview(e){
				uni.previewImage({
					urls:[e]
				})
			},
			openPopup(e){
				this.$refs.popup.open(e.id)
			},
		},
		onLoad() {
			this.getList()
		}
	}
</script>

<style scoped lang="scss">
	.content {
		padding: 30rpx;
	}

	.item {
		background: #FFFFFF;
		border-radius: 10rpx;
		padding: 36rpx 30rpx 30rpx;
		display: flex;
		margin-bottom: 20rpx;
		.left {
			width: 120rpx;
			height: 120rpx;
			border-radius: 12rpx;
			overflow: hidden;
			margin-right: 23rpx;
			image {
				width: 120rpx;
				height: 120rpx;
			}
		}
		.right {
			flex: 1;
			.name {
				text {
					max-width: 300rpx;
					font-size: 34rpx;
					font-weight: 600;
					color: #000000;
					line-height: 48rpx;
				}
				view {
					padding: 6rpx 12rpx;
					background: #E3FBEB;
					border-radius: 10rpx;
					text-align: center;
					font-size: 22rpx;
					color: #549662;
				}
			}
			.info {
				margin-top: 10rpx;
				display: flex;
				align-items: center;
				text {
					font-size: 26rpx;
					color: #7A7979;
					line-height: 37rpx;
					i {
						color: #333;
						font-style: normal;
					}
				}
			}
			.rate {
				.btn {
					width: 120rpx;
					height: 48rpx;
					background: #2E7EFA;
					box-shadow: 0rpx 0rpx 5rpx 5rpx rgba(46,126,250,0.12);
					border-radius: 24rpx;
					text-align: center;
					font-size: 26rpx;
					color: #FFFFFF;
					line-height: 48rpx;
				}
			}
		}
	}
</style>